package com.customization.unionpay.contract.util;


import com.alibaba.fastjson.JSONObject;
import org.bouncycastle.crypto.InvalidCipherTextException;
import weaver.integration.logging.Logger;
import weaver.integration.logging.LoggerFactory;

import java.io.UnsupportedEncodingException;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;

public class ContractNoticeUtil {

    private static Logger log = LoggerFactory.getLogger("ContractNoticeUtil", ContractNoticeUtil.class.getName());

    private static String sys_id = "finance_test_79NUWsvq";
    //测试
    private static String publicKey = "04C365B40F3691CBADF01FE41CAC1410D9B5FE80F8C414F8352A2A988AB614B2F0743014ECFA39C7EFA186E7CE3AA0B1B39D36AA3D7970FF770F0A11021790A805";
    //生产
    // private static String publicKey = "04C4E9639075CCE120F19F6B7D17D69C12B47F16CE0F884471B15ECEA2CF9BC1C099E4191895B4BE4A5ACA3D525F1800B8D9BE35594994B5E4A69EBAC70429F451";
    private static String url = "https://172.16.4.78:443/contract/foreign/financial/getState";


    /**
     * 调用合同中心通知状态
     * @param signNo 合同编号
     * @param filingStatus 财务备案状态：1:财务备案流程开始；2:财务备案流程结束；
     * @param filingStartDate 当为通知财务备案流程开始时必填；格式：yyyy-MM-dd HH:mm:ss
     * @param filingEndDate 当为通知财务备案流程结束时必填；格式：yyyy-MM-dd HH:mm:ss
     * @return
     */
    public static boolean sendMsg2HTZX(String signNo, Integer filingStatus, String filingStartDate, String filingEndDate) throws InvalidCipherTextException, UnsupportedEncodingException {
        Date date = new Date();
        String token = date.getTime()+"@@"+sys_id+"@@"+date.getTime();
        //使用公匙加密
       String sectoken = "";
        //设置请求头参数
        Map<String, String> headers = new HashMap<>();
        headers.put("Content-Type","application/json");
        headers.put("sectoken",sectoken);
        //设置业务参数
        JSONObject params = new JSONObject();
        params.put("signNo",signNo);
        params.put("filingStatus",filingStatus);
        if(null != filingStartDate){
            params.put("filingStartDate",filingStartDate);
        }
        if(null != filingEndDate){
            params.put("filingEndDate",filingEndDate);
        }

        boolean result = false;
        try {

        }catch (Exception e){
            log.info("error : {}",e);
            throw new RuntimeException(e);
        }
        return result;
    }
}
